<!--室内图数量不足-->
<template>
  <div>
    <com-image-list
      :imageVO.sync="imageVO"
      :houDelId="houDelId"
      :isVrHouse="info.hmDelSummaryInfo.houSubType == 1"
      :houDelVO="info.houDelVO"
      :houImageVO="info.houImageVO"
      :sourceHouseConfig="sourceHouseConfig"
    ></com-image-list>
  </div>
</template>
<script>
import ComImageList from "@/views/house/com/com-image-list.vue";
import { mapGetters, mapState } from 'vuex';
import { houseImages } from '@/config/house/houseDetailConfig';
import { updateImage } from '@/api/user';
export default {
  name: "ComIndoorAssets",
  components: {
    ComImageList,
  },
  shulan: true,
  props: {},
  data() {
    return {
      sourceHouseConfig: [houseImages.find((v) => v.title == "室内照片")],
      imageVO: {
        houseTypeList: [], //房型图
        indoorList: [], //室内图
        circumList: [], //小区图
      },
      modifiedCount: 2, //数据改动的次数（多一次用作初始化时的修改），变为0则表示数据被修改了
    };
  },
  created() {},
  mounted() {},
  watch: {
    ["imageVO.indoorList"]() {
      this.modifiedCount--
    }
  },
  computed: {
    ...mapState({
      info: (state) => state.houseInfo
    }),
    ...mapGetters({
      houDelId: "houseInfo/houDelId",
    }),
  },
  methods: {
    save() {
      if (this.modifiedCount > 0) return Promise.resolve()

      let houImgList = [...this.imageVO.indoorList, ...this.imageVO.houseTypeList, ...this.imageVO.circumList];
      houImgList.forEach((item, index) => {
        item.cover = index;
        return item;
      });

      return updateImage({ houImgList })
    }

  },
};
</script>
<style></style>
